<%--
  Created by IntelliJ IDEA.
  User: 甘汝雷
  Date: 2017/5/2
  Time: 14:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--解析表达式--%>
<%@ page isELIgnored="false" %>
<%--引入jstl--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--引入springMVC form--%>
<%@ taglib prefix="sf" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="page" uri="/xianzhiOA/pageTag" %>
<%@ taglib prefix="p" uri="/xianzhiOA/powerTag" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>工作质量一览</title>
    <script type="application/javascript">
        window.onload = function () {
            if('${open}'=='1'){
                var addBox = document.getElementById("addBox");
                var selBox = document.getElementById("selBox");
                selBox.style.display = "none";
                addBox.style.display = "block";
            }
        }
        function edit() {
            document.getElementById("qualityForm").action = "${pageContext.request.contextPath}/Quality/qualityEdit.emp";
            document.getElementById("qualityId").value = null;
            document.getElementById("qualityForm").submit();
        }
        function myBug() {
            document.getElementById("num").value = 0;
            document.getElementById("qualityForm").submit();
        }
        function whoBug() {
            document.getElementById("num").value = 1;
            document.getElementById("qualityForm").submit();
        }
        function pToSub(page) {
            if(page!=undefined){
                var pageInp = document.getElementById("page");
                pageInp.value = page;
                var form = document.getElementById("qualityForm");
                form.submit();
            }
        }
        function deleteCheck(id,iId) {
            if (confirm("确定要删除吗")) {
                window.location.href = "${pageContext.request.contextPath}/Quality/deleteQuality.emp?qualityId=" + id+"?injectId="+iId;
            }
        }
    </script>
</head>
<body>
<!--头部开始-->
<jsp:include page="headerBack.jsp"></jsp:include>
<!-- 导航 -->
<jsp:include page="leftBack.jsp"></jsp:include>
<div class="main">
    <!--内容页头部-->
    <div class="page-header">
        <div class="pull-left">
            <ol class="breadcrumb visible-sm visible-md visible-lg">
                <li><a href="${pageContext.request.contextPath}/Login/goHomePage"><i class="icon fa fa-home"></i>主页</a></li>
                <li class="active"><i class="fa fa-pencil"></i>基本信息</li>
            </ol>
        </div>
        <div class="pull-right">
            <h2>主页</h2>
        </div>
    </div>
    <!--查询页-->
    <sf:form id="qualityForm" action="${pageContext.request.contextPath}/Quality/selQualityAll.emp" modelAttribute="quality" method="post" class="search1">
        <div style="height: 40px">
            <c:if test="${open==1}"><button type="submit" class="three btn btn-primary">返回</button></c:if>
            <p:power jspPower="工作质量：添加">
                <button onclick="edit()" type="button" class="three btn btn-primary">添加</button>
            </p:power>
            <c:if test="${open==1}">
                <p:power jspPower="工作质量：修改">
                    <a href="${pageContext.request.contextPath}/Quality/qualityEdit.emp?qualityId=${q.qualityId}" class="three btn btn-primary">修改</a>
                </p:power>
            </c:if>
            <c:if test="${open!=1}"><a href="${pageContext.request.contextPath}/Quality/selQualityAll.emp" class="three btn btn-primary">重置</a></c:if>
        </div>
        <input type="hidden" id="page" name="page" value="${page}"/>
        <input type="hidden" id="pages" name="pages" value="${pages}"/>
        <input type="hidden" id="num" name='num' value="${num}"/>
        <sf:input path="qualityId" type="hidden" value="1"/>
        <c:if test="${open!=1}">
            <div.right><button onclick="whoBug()" type="button" class="quality_b">别人的bug</button></div.right>
            <div.right><button onclick="myBug()" type="button" class="quality_b">我的bug</button></div.right>
            <c:if test="${quality.qualityOfficial==userLogin.empId}"><sf:input path="empName1" style="width: 120px" placeholder="测试人..."/></c:if>
            <c:if test="${quality.qualityAudit==userLogin.empId}"><sf:input path="empName" style="width: 120px" placeholder="负责人..."/></c:if>
            <input style="width: 95px" class="sang_Calender" name="begin" type="text"
               value="<fmt:formatDate type="both" value="${begin}" pattern="yyyy-MM-dd"/>" placeholder="创建时间...">至
        <input style="width: 95px" class="sang_Calender" name="end" type="text"
               value="<fmt:formatDate type="both" value="${end}" pattern="yyyy-MM-dd"/>" placeholder="创建时间...">
        <button type="submit" class="one"><span class="fa fa-search"></span></button>
        </c:if>
    </sf:form>
    <!--展示页-->
    <div class="well" id="selBox">
        <c:if test="${qualityList.isEmpty()}"><h3 style="text-align: center">工作质量信息不存在</h3></c:if>
        <c:if test="${!qualityList.isEmpty()}">
            <c:if test="${num==0}">
                <table class="table" id="now">
                    <thead>
                    <tr>
                        <th class="vv">测试人</th>
                        <th class="vv">归属项目</th>
                        <th class="vv">bug总数</th>
                        <th class="vv">清除数</th>
                        <th class="vv">未清除数</th>
                        <th class="vv">所在周期</th>
                        <th class="dd">详情</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${qualityList}" var="q">
                        <tr>
                            <td>${q.emp1.empName}</td>
                            <td>${q.project.projectName}</td>
                            <td>${q.bugSun}</td>
                            <td>${q.bugClear}</td>
                            <td>${q.bugSun-q.bugClear}</td>
                            <td>${q.qualityBegin}~${q.qualityEnd}</td>
                            <td>
                                <p:power jspPower="工作质量：详情">
                                <a href="${pageContext.request.contextPath}/Quality/selById.emp?qualityId=${q.qualityId}"
                                   role="button" data-toggle="modal"><i class="fa fa-flag"></i></a>
                                </p:power>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </c:if>
            <c:if test="${num==1}">
                <table class="table" id="now">
                    <thead>
                    <tr>
                        <th class="vv">负责人</th>
                        <th class="vv">归属项目</th>
                        <th class="vv">bug总数</th>
                        <th class="vv">清除数</th>
                        <th class="vv">未清除数</th>
                        <th class="vv">所在周期</th>
                        <p:power jspPower="工作质量：删除">
                            <th class="dd">删除</th>
                        </p:power>
                        <p:power jspPower="工作质量：修改">
                            <th class="dd">修改</th>
                        </p:power>
                        <p:power jspPower="工作质量：详情">
                            <th class="dd">详情</th>
                        </p:power>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${qualityList}" var="q">
                        <tr>
                            <td>${q.emp.empName}</td>
                            <td>${q.project.projectName}</td>
                            <td>${q.bugSun}</td>
                            <td>${q.bugClear}</td>
                            <td>${q.bugSun-q.bugClear}</td>
                            <td>${q.qualityBegin}~${q.qualityEnd}</td>
                            <p:power jspPower="工作质量：删除">
                                <td>
                                    <a onclick="deleteCheck(${q.qualityId})" role="button" data-toggle="modal"><i class="fa fa-times"></i></a>
                                </td>
                            </p:power>
                            <p:power jspPower="工作质量：修改">
                                <td>
                                    <a href="${pageContext.request.contextPath}/Quality/qualityEdit.emp?qualityId=${q.qualityId}" role="button" data-toggle="modal"><i class="fa fa-pencil"></i></a>
                                </td>
                            </p:power>
                            <p:power jspPower="工作质量：详情">
                                <td><a href="${pageContext.request.contextPath}/Quality/selById.emp?qualityId=${q.qualityId}"
                                       role="button" data-toggle="modal"><i class="fa fa-flag"></i></a></td>
                            </p:power>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </c:if>
        </c:if>
    </div>
    <div class="well" id="addBox" style="display: none">
    <c:if test="${qualityList.isEmpty()}"><h3 style="text-align: center">工作质量详细信息不存在</h3></c:if>
    <c:if test="${!qualityList.isEmpty()}">
        负责人：${q.emp.empName} 归属项目：${q.project.projectName} 所在周期：${q.qualityBegin}~${q.qualityEnd}
        <c:if test="${q.qualityAudit==userLogin.empId}">
        </c:if>
            <table class="table" id="now">
                <thead>
                <tr>
                    <th class="vv">bug状态</th>
                    <th class="vv">严重等级</th>
                    <th class="vv">设计</th>
                    <th class="vv">编码</th>
                    <th class="vv">测试</th>
                    <th class="vv">总计</th>
                    <c:if test="${q.emp1.empId==userLogin.empId}"><th class="vv">操作</th></c:if>
                </tr>
                </thead>
                <tbody>
                    <c:forEach items="${q.injectList}" var="i">
                        <tr>
                            <c:if test="${i.injectGrade==1}"><td rowspan="3" style="line-height: 100px">缺陷注入</td></c:if>
                            <c:if test="${i.injectGrade==1}"><td>灾难级/严重级</td></c:if>
                            <c:if test="${i.injectGrade==2}"><td>次严重级</td></c:if>
                            <c:if test="${i.injectGrade==3}"><td>一般/其它</td></c:if>
                            <td>${i.injectDesign}</td>
                            <td>${i.injectCode}</td>
                            <td>${i.injectTest}</td>
                            <td>${i.injectDesign+i.injectCode+i.injectTest}</td>
                        </tr>
                    </c:forEach>
                    <c:forEach items="${q.eliminateList}" var="e">
                        <tr>
                            <c:if test="${e.eliminateGrade==1}"><td rowspan="3" style="line-height: 100px">缺陷清除</td></c:if>
                            <c:if test="${e.eliminateGrade==1}"><td>灾难级/严重级</td></c:if>
                            <c:if test="${e.eliminateGrade==2}"><td>次严重级</td></c:if>
                            <c:if test="${e.eliminateGrade==3}"><td>一般/其它</td></c:if>
                            <td>${e.eliminateDesign}</td>
                            <td>${e.eliminateCode}</td>
                            <td>${e.eliminateTest}</td>
                            <td>${e.eliminateDesign+e.eliminateCode+e.eliminateTest}</td>
                        </tr>
                    </c:forEach>

                <tr>
                    <th>缺陷清除率</th>
                    <th></th>
                    <th>${q.design}%</th>
                    <th>${q.code}%</th>
                    <th>${q.test}%</th>
                    <th>${q.amount}%</th>
                    <th></th>
                    <th></th>
                </tr>
                </tbody>
            </table>
    </c:if>
    </div>
        <c:if test="${pages > 1}">
            <div style="float: right">
                <ul class="pagination">
                    <page:paging length="10" page="${page}" pages="${pages}"/>
                </ul>
            </div>
        </c:if>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath}/dist/backEnd/js/datetime.js"></script>
</body>
</html>
